MySQL - Command - ii
| To view all databases created in MySQL server:
|
| To create a new database with name mydb:
|
| To Select or Use a Database named mydb:
|
| To view all Tables in Database
|
Create a Table:
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
email VARCHAR(100)
);
|
| Insert Data:
|
| View Data
|
| Update Data
|
| Delete Data
|
| To remove table from database: |
| Delete a Database: Database must exist.
|
| Add a New Column to existing table:
|
| Modify (change data type)an Existing Column:
|
| Rename a Column, that is change name of column with new name:
|
| Add Unique Constraint to existing table:
|
| Remove Unique Constraint from existing column.
|
| Create an Index: Index makes search fast.
|
| Delete an Index from existing attribute having index:
|
| Filtering Records: That is displaying records from that based on specified
conditions: here records of only those users will be display whose age is
greater than 18.
|
| Sorting Records:
|
| Limit Number of Results: displaying only specified number of records
form table or tables.
|
| Count Records: Display number of records in a given table (relation).
|
| Grouping Data: That is grouping records of table (relation) according
to specified attributes.
|
| Using LIKE for Searching: We can provide part of string to search using LIKE
keyword. |
| JOIN Between Tables: Two tables can be joined based on similar attributes
which both table have.
|